package com.example.tccdemo.controller;

import com.example.tccdemo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @describte:TODO
 * @program:distribute-transaction
 * @author:zhengdp
 * @create:2021-09-26 22:22:27
 **/
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "handleOrder",method = RequestMethod.POST)
    public String handleOrder(int orderId){
        try{
            int result = orderService.handleOrder(orderId);
            if(result==0) return "success";
            return "fail";
        }catch (Exception e){
            return "fail";
        }
    }
}
